﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Areas.Manage.Models.Site.LoginLogModel>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	登录日志
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <% Html.DisableClientValidation(); %>
    <% Html.BeginForm(); %>
    <table class="table" width="100%">
        <tr class="th"><th colspan="7" align="left">查找条件</th></tr>
        <tr>
            <td align="right">登录名：</td><td align="left"><%=Html.TextBoxFor(p => p.Serch.LoginName, new { @class="text100"})%></td>
            <td align="right">日期：</td><td align="left"><%=Html.TextBoxFor(p => p.Serch.StartTime, new { @class="text80", onfocus = "WdatePicker()"})%></td>
            <td align="right">到：</td><td align="left"><%=Html.TextBoxFor(p => p.Serch.EndTime, new { @class = "text80", onfocus = "WdatePicker()" })%></td>
            <td rowspan="2">
                <input type="submit" value="查找" name="SerchData" />
            </td>
        </tr>
        <tr>
            <td align="right">登录IP：</td><td align="left"><%=Html.TextBoxFor(p => p.Serch.LoginIP, new { @class="text100"})%></td>
            <td align="right">用户类型：</td><td align="left"><%=Html.DropDownListFor(p => p.Serch.Type, Model.Types)%></td>
            <td align="right">登录结果：</td><td align="left"><%=Html.DropDownListFor(p => p.Serch.Result, Model.Results)%></td>
        </tr>
    </table>
    <% Html.EndForm(); %>
    <% Html.BeginForm(new { id="clearlogform"},null); %>
    <table class="table" width="100%">
        <tr>
            <td align="right">清除记录到：</td>
            <td align="left">
                <input type="text" id="Date" name="Date" value='<%=ViewData["Date"] %>' class="text80" validate="{required:true,messages:{required:'*'}}" onfocus="WdatePicker()" />
                <%=Html.ValidationMessage("Date") %>
            </td>
            <td align="right">安全密码：</td>
            <td align="left">
                <input type="password" id="Pwd" name="Pwd" validate="{required:true,messages:{required:'*'}}" class = "text100" />
                <%=Html.ValidationMessage("Pwd") %>
            </td>
            <td align="right">清除记录：</td>
            <td align="left"><input type="submit" name="ClearData" value="清除" /></td>
        </tr>
    </table>
    <% Html.EndForm(); %>
    <p />
    <table class="table" width="100%">
        <tr class="th"><th>登录名</th><th>类型</th><th>日期</th><th>IP地址</th><th>结果</th></tr>
        <% if (Model.SumCount > 0)%>
        <%{ %>
        <% foreach (var item in Model.Logs) %>
        <%{ %>
        <tr class='<%=item.LoginResult==(short)LoginResult.PWDError?"hightlight":item.LoginResult==(short)LoginResult.Locked?"hightlight1":"" %>'>
            <td><%=item.LoginName%></td>
            <td><%=((LoginLogType)item.LoginType).GetName()%></td>
            <td><%=item.LoginTime.ToString("yyyy-MM-dd HH:mm:ss")%></td>
            <td><%=item.LoginIP%></td>
            <td><%=((LoginResult)item.LoginResult).GetName()%></td>
        </tr>
        <%} %>
        <tr>
            <td colspan="5"><%=Html.Pager(Model.Page, Model.PageSize, Model.SumCount, "Page", Url.Route(Model.Serch), "PageSize")%></td>
        </tr>
        <%} %>
        <% else %>
        <%{ %>
        <tr>
            <td colspan="5">没有符合条件的记录！</td>
        </tr>
        <%} %>
    </table>
</div>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
    <style type="text/css">
        .hightlight{ color:Red;}
        .hightlight1{ color:#C0B705;}
    </style>
    <script src='<%=Url.Content("~/Scripts/jquery.metadata.js") %>' type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#clearlogform").validate();
        });
    </script>
</asp:Content>
